
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Go 语言环境安装 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../part3/" />
    
    
    <link rel="prev" href="../part1/" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../part1/">
            
                <a href="../part1/">
            
                    
                    Go 语言简介
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3" data-path="./">
            
                <a href="./">
            
                    
                    Go 语言环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../part3/">
            
                <a href="../part3/">
            
                    
                    Go 语言结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../part4/">
            
                <a href="../part4/">
            
                    
                    Go 语言基础语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../part5/">
            
                <a href="../part5/">
            
                    
                    Go 语言数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../part6/">
            
                <a href="../part6/">
            
                    
                    Go 语言变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../part7/">
            
                <a href="../part7/">
            
                    
                    Go 语言常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../part8/">
            
                <a href="../part8/">
            
                    
                    Go 语言运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../part9/">
            
                <a href="../part9/">
            
                    
                    Go 语言条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../part10/">
            
                <a href="../part10/">
            
                    
                    Go 语言循环语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../part11/">
            
                <a href="../part11/">
            
                    
                    Go 语言函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../part12/">
            
                <a href="../part12/">
            
                    
                    Go 语言数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../part13/">
            
                <a href="../part13/">
            
                    
                    Go 语言指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../part14/">
            
                <a href="../part14/">
            
                    
                    Go 语言结构体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../part15/">
            
                <a href="../part15/">
            
                    
                    Go 语言切片(Slice)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../part16/">
            
                <a href="../part16/">
            
                    
                    Go 语言范围(Range)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../part17/">
            
                <a href="../part17/">
            
                    
                    Go 语言Map(集合)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../part18/">
            
                <a href="../part18/">
            
                    
                    Go 语言递归函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../part19/">
            
                <a href="../part19/">
            
                    
                    Go 语言类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../part20/">
            
                <a href="../part20/">
            
                    
                    Go 语言接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="../part21/">
            
                <a href="../part21/">
            
                    
                    Go 错误处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="../part22/">
            
                <a href="../part22/">
            
                    
                    Go 并发
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Go 语言环境安装</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="go-&#x8BED;&#x8A00;&#x73AF;&#x5883;&#x5B89;&#x88C5;">Go &#x8BED;&#x8A00;&#x73AF;&#x5883;&#x5B89;&#x88C5;</h1>
<p>Go &#x8BED;&#x8A00;&#x652F;&#x6301;&#x4EE5;&#x4E0B;&#x7CFB;&#x7EDF;&#xFF1A;</p>
<ul>
<li>Linux</li>
<li>FreeBSD</li>
<li>Mac OS X&#xFF08;&#x4E5F;&#x79F0;&#x4E3A; Darwin&#xFF09;</li>
<li>Windows</li>
</ul>
<p>&#x5B89;&#x88C5;&#x5305;&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#x4E3A;&#xFF1A;<a href="https://golang.org/dl/&#x3002;" target="_blank">https://golang.org/dl/&#x3002;</a></p>
<p>&#x5982;&#x679C;&#x6253;&#x4E0D;&#x5F00;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x5730;&#x5740;&#xFF1A;<a href="https://golang.google.cn/dl/&#x3002;" target="_blank">https://golang.google.cn/dl/&#x3002;</a></p>
<p>&#x5404;&#x4E2A;&#x7CFB;&#x7EDF;&#x5BF9;&#x5E94;&#x7684;&#x5305;&#x540D;&#xFF1A;</p>
<table>
    <tr>
        <th>&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;</th>
        <th>&#x5305;&#x540D;</th>
    </tr>
    <tr>
        <td>Microsoft Windows</td>
        <td>go1.15.6.windows-amd64.msi</td>
    </tr>
    <tr>
        <td>Linux</td>
        <td>go1.15.6.linux-amd64.tar.gz</td>
    </tr>
    <tr>
        <td>Apple macOS</td>
        <td>go1.15.6.darwin-amd64.pkg</td>
    </tr>
    <tr>
        <td>FreeBSD</td>
        <td>go1.15.6.freebsd-386.tar.gz</td>
    </tr>
</table>


<center>
    <img style="border-radius: 0.3125em;
    box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.08);" src="../source/images/part2/01.png">
    <br>
    <div style="color:orange; border-bottom: 0px solid #d9d9d9;
    display: inline-block;
    color: #999;ds
    padding: 5px;">&#x5404;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#x622A;&#x56FE;</div>
</center>

<h2 id="unixlinuxmac-os-x-&#x548C;-freebsd-&#x5B89;&#x88C5;">UNIX/Linux/Mac OS X &#x548C; FreeBSD &#x5B89;&#x88C5;</h2>
<p>&#x4EE5;&#x4E0B;&#x4ECB;&#x7ECD;&#x4E86;&#x5728;UNIX/Linux/Mac OS X, &#x548C; FreeBSD&#x7CFB;&#x7EDF;&#x4E0B;&#x4F7F;&#x7528;&#x6E90;&#x7801;&#x5B89;&#x88C5;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ol>
<li><p>&#x4E0B;&#x8F7D;&#x4E8C;&#x8FDB;&#x5236;&#x5305;&#xFF1A;go1.4.linux-amd64.tar.gz&#x3002;</p>
</li>
<li><p>&#x5C06;&#x4E0B;&#x8F7D;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x5305;&#x89E3;&#x538B;&#x81F3; /usr/local&#x76EE;&#x5F55;&#x3002;</p>
</li>
</ol>
<pre><code class="lang-sh">tar -C /usr/<span class="hljs-built_in">local</span> -xzf go1.4.linux-amd64.tar.gz
</code></pre>
<ol>
<li>&#x5C06; <code>/usr/local/go/bin</code> &#x76EE;&#x5F55;&#x6DFB;&#x52A0;&#x81F3;PATH&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF1A;<pre><code class="lang-sh"><span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$PATH</span>:/usr/<span class="hljs-built_in">local</span>/go/bin
</code></pre>
</li>
</ol>
<blockquote>
<p>&#x6CE8;&#x610F;&#xFF1A;MAC &#x7CFB;&#x7EDF;&#x4E0B;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; .pkg &#x7ED3;&#x5C3E;&#x7684;&#x5B89;&#x88C5;&#x5305;&#x76F4;&#x63A5;&#x53CC;&#x51FB;&#x6765;&#x5B8C;&#x6210;&#x5B89;&#x88C5;&#xFF0C;&#x5B89;&#x88C5;&#x76EE;&#x5F55;&#x5728; /usr/local/go/ &#x4E0B;&#x3002;</p>
</blockquote>
<hr>
<h2 id="windows-&#x7CFB;&#x7EDF;&#x4E0B;&#x5B89;&#x88C5;">Windows &#x7CFB;&#x7EDF;&#x4E0B;&#x5B89;&#x88C5;</h2>
<p>Windows &#x4E0B;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; .msi &#x540E;&#x7F00;(&#x5728;&#x4E0B;&#x8F7D;&#x5217;&#x8868;&#x4E2D;&#x53EF;&#x4EE5;&#x627E;&#x5230;&#x8BE5;&#x6587;&#x4EF6;&#xFF0C;&#x5982;go1.4.2.windows-amd64.msi)&#x7684;&#x5B89;&#x88C5;&#x5305;&#x6765;&#x5B89;&#x88C5;&#x3002;</p>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B; .msi &#x6587;&#x4EF6;&#x4F1A;&#x5B89;&#x88C5;&#x5728; c:\Go &#x76EE;&#x5F55;&#x4E0B;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5C06; c:\Go\bin &#x76EE;&#x5F55;&#x6DFB;&#x52A0;&#x5230; Path &#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;&#x3002;&#x6DFB;&#x52A0;&#x540E;&#x4F60;&#x9700;&#x8981;&#x91CD;&#x542F;&#x547D;&#x4EE4;&#x7A97;&#x53E3;&#x624D;&#x80FD;&#x751F;&#x6548;&#x3002;</p>
<h3 id="&#x5B89;&#x88C5;&#x6D4B;&#x8BD5;">&#x5B89;&#x88C5;&#x6D4B;&#x8BD5;</h3>
<p>&#x521B;&#x5EFA;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55; <code>C:\&gt;Go_WorkSpace</code>&#x3002;</p>
<p>test.go &#x6587;&#x4EF6;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">&quot;fmt&quot;</span>

<span class="hljs-keyword">func</span> main() {
   fmt.Println(<span class="hljs-string">&quot;Hello, World!&quot;</span>)
}
</code></pre>
<p>&#x4F7F;&#x7528; go &#x547D;&#x4EE4;&#x6267;&#x884C;&#x4EE5;&#x4E0A;&#x4EE3;&#x7801;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-sh">C:\Go_WorkSpace&gt;go run test.go

Hello, World!
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../part1/" class="navigation navigation-prev " aria-label="Previous page: Go 语言简介">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../part3/" class="navigation navigation-next " aria-label="Next page: Go 语言结构">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Go 语言环境安装","level":"1.3","depth":1,"next":{"title":"Go 语言结构","level":"1.4","depth":1,"path":"part3/README.md","ref":"part3/README.md","articles":[]},"previous":{"title":"Go 语言简介","level":"1.2","depth":1,"path":"part1/README.md","ref":"part1/README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"part2/README.md","mtime":"2021-01-18T02:29:37.491Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-01-21T06:29:04.898Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

